package team.sun.sss.controller.staff;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import team.sun.sss.dao.staff.*;
import team.sun.sss.service.staff.StaffServiceImpl;
import team.sun.sss.service.user.UserServiceImpl;

@Controller
public class StaffDeleteController {
    @Autowired
    StaffServiceImpl staffService;
    @Autowired
    UserServiceImpl userService;
    @Autowired
    StaffCertificateDao staffCertificateDao;
    @Autowired
    StaffCourseDao staffCourseDao;
    @Autowired
    StaffRewardDao staffRewardDao;
    @Autowired
    StaffTrainDao staffTrainDao;
    @Autowired
    StaffTakeStudentDao staffTakeStudentDao;
    @Autowired
    StaffThesisDao staffThesisDao;
    @Autowired
    StaffDao staffDao;

    //带学生删除
    @GetMapping("/take_student_delete/{id}/{sta_num}")
    public String  takeStudentDelete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffTakeStudentDao.deleteStaffTakeStudent(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
    //奖励情况删除
    @GetMapping("/reward_delete/{id}/{sta_num}")
    public String rewardDelete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffRewardDao.deleteStaffReward(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
    //职业培训删除
    @GetMapping("/train_delete/{id}/{sta_num}")
    public String trainDelete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffTrainDao.deleteStaffTrain(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
    //职业资格证书删除
    @GetMapping("/certificate_delete/{id}/{sta_num}")
    public String certificate_delete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffCertificateDao.deleteStaffCertificate(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
    //论文发表删除
    @GetMapping("/thesis_delete/{id}/{sta_num}")
    public String thesisDelete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffThesisDao.deleteStaffThesis(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
    //教学情况删除
    @GetMapping("/course_delete/{id}/{sta_num}")
    public String courseDelete(@PathVariable(name = "id") String id,@PathVariable(name = "sta_num") String sta_num){
        staffCourseDao.deleteStaffCourse(Integer.parseInt(id));
        return "redirect:/staff_update/"+sta_num;
    }
}
